<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue-路由</title>
	</head>
	<body>
		<div id="app">
			<router-link to="home" >家</router-link>
			<router-link to="dog">宠物</router-link>
			<router-view></router-view>
		</div>
		<template id = "homeTem">
			<div>
				<h1>家</h1>
			</div>
		</template>
		<template id ="dogTem">
			<div>
				<h1>狗</h1>
			</div>
		</template>
		<script src="../js/vue.js">
		</script>
		<script src="../js/vue-router.js"></script>
		<script type="text/javascript">
			let homeCom = {
				template:"#homeTem"
			}
			let dogCom = {
				template :"#dogTem"
			}
			const router = new VueRouter({
				routes:[
					{path:"/",redirect:"/home"},
					{path:"/home",component:homeCom},
					{path:"/dog",component:dogCom}
				]
			})
			const app = new Vue({
				el: "#app",
				router
			})
		</script>
	</body>
</html>
